#include <stdio.h>
#include <malloc.h>
struct weapon
{
    int price;
    int atk;
    struct weapon *next;
};
struct weapon *create2()
{
    int atk, price;
    scanf("%d,%d", &atk, &price);
    struct weapon *head = NULL, *pre = NULL, *p = NULL;
    while (price != 0 && atk != 0)
    {
        p = (struct weapon *)malloc(sizeof(struct weapon));
        p->atk = atk;
        p->price = price;
        if (head == NULL)
        {
            head = p;
            pre = p;
        }
        else
        {
            pre->next = p;
            pre = p;
        }
        scanf("%d,%d", &atk, &price);
    }
    if (pre != NULL)
    {
        pre->next = NULL;
    }
    return head;
}
struct weapon *create()
{
    struct weapon *head;
    struct weapon *p1, *p2;
    //当前节点个数
    int n = 0;
    p1 = (struct weapon *)malloc(sizeof(struct weapon));
    scanf("%d,%d", &p1->atk, &p1->price);
    head = NULL;
    while (p1->price != 0)
    {
        n++;
        if (n == 1)
        {
            head = p1;
        }
        else
        {
            p2->next = p1;
        }
        p2 = p1;
        p1 = (struct weapon *)malloc(sizeof(struct weapon));
        scanf("%d,%d", &p1->atk, &p1->price);
    }
    p2->next = NULL;
    return head;
}

int main()
{
    struct weapon *p;
    p = create2();
    printf("开始打印:\n");
    while (p != NULL)
    {
        printf("%d,%d\n", p->atk, p->price);
        p = p->next;
    }
    return 0;
}